//
//  HomeViewController.swift
//  微博（swift）
//
//  Created by 谢曦 on 2017/5/4.
//  Copyright © 2017年 谢曦. All rights reserved.
//

import UIKit

class HomeViewController: BaseViewController {

    override func viewDidLoad()
    {
        super.viewDidLoad()
//        self.placeView=setPlaceView()
        self.setPlaceView()
          setNav()
    }

  
    
    
     // MARK: - action
    
    func toFollow()  {
        print(#function)
    }
     // MARK: - tableView
    
    override func loadData() {
        NetworkManager.shareInstance.request(type: .GET, url: "https://api.weibo.com/2/statuses/home_timeline.json", param: [:], success: { (response) in
            print(response)
        }) { (error) in
            
        }
    }
    
    
}


extension HomeViewController{
  fileprivate  func setNav()  {
        navigationItem.rightBarButtonItem = UIBarButtonItem.init(themeBtnTitle: "登陆", target: self, action: #selector(toLogin))
        navigationItem.leftBarButtonItem = UIBarButtonItem.init(themeBtnTitle: "注册", target: self, action: #selector(toRegister))

      
    }
    fileprivate  func setPlaceView(){
//        let placeView = UIView()
        
        let image = UIImageView.init(image: UIImage.init(named: "visitordiscover_feed_image_house"))
        let lable = UILabel()
        lable.text = "赶紧去关注吧!"
        lable.sizeToFit()
        lable.textColor=UIColor.init(hexString: "E1E1E1")
        
        let button = UIButton()
        button.setTitle("去关注", for: .normal)
        button.setTitleColor(UIColor.orange, for: .normal)
        button.layer.borderColor=UIColor.init(hexString: "E1E1E1").cgColor
        button.layer.borderWidth=1
        button.addTarget(self, action: #selector(toFollow), for: .touchUpInside)
        
        
        placeView.addSubview(image)
        placeView.addSubview(lable)
        placeView.addSubview(button)
        
        
        image.snp.makeConstraints { (make) in
            make.center.equalTo(placeView)
        }
        lable.snp.makeConstraints { (make) in
            make.centerX.equalTo(placeView)
            make.top.equalTo(image.snp.bottom).offset(10)
        }
        button.snp.makeConstraints { (make) in
            make.centerX.equalTo(placeView)
            make.top.equalTo(lable.snp.bottom).offset(10)
            make.size.equalTo(CGSize(width:100,height:30))
        }

//        
//    return placeView
    
    }
   
}




